//
//  QQMusicCell.swift
//  JSQQMusic
//
//  Created by 马万里 on 2017/10/19.
//  Copyright © 2017年 马万里. All rights reserved.
//

import UIKit

class QQMusicCell: UITableViewCell {

    @IBOutlet weak var singerNameLabel: UILabel!
    @IBOutlet weak var songNameLabel: UILabel!
    @IBOutlet weak var singerIconImageView: UIImageView!
    
    var QQMusic: QQMusicModel? {
        didSet {
            singerIconImageView.image = UIImage(named:
                (QQMusic?.singerIcon)!)
            songNameLabel.text = QQMusic?.name
            singerNameLabel.text = QQMusic?.singer
        }
    }
    
    
    
    class func cellWithTableView(tableView: UITableView) -> QQMusicCell {
        let cellID = "music"
        var cell = tableView.dequeueReusableCell(withIdentifier: cellID) as? QQMusicCell
        if cell == nil {
            print("test")
            cell = Bundle.main.loadNibNamed("QQMusicCell", owner: self, options: nil)?.first as? QQMusicCell
        }
        return cell!
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        singerIconImageView.layer.cornerRadius = singerIconImageView.bounds.size.width * 0.5
        singerIconImageView.layer.masksToBounds = true
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
}
